Skip to content

orco — Org Mode Column add-on for Thunderbird

License

Notifications You must be signed in to change notification settings

maxnikulin/orco

Repository files navigation

orco — Org Mode column, a Thunderbird add-on

Allows to see what mail messages are mentioned in your notes.

screenshots/orco-0.4.0-link-popup.png

orco-0.5.1 highlight

Mostly restored the custom column feature for Thunderbird-115.10 and newer. Ability to add custom column was lost during Thunderbird GUI redesign and it took time to enable it again. I have not figured out if it is possible to mark collapsed thread, and it is regression in comparison to Thunderbird-102.

See https://github.com/maxnikulin/orco/releases/ Already installed add-on should be updated unless it is disabled. [2024-06-25 Tue]

It is a beta version

Compatibility: Thunderbird-91 and above with a hole between Thunderbird-111 and Thunderbird-115.10/Thunderbird-124, see Bug #1817682.

Warning. Project development stage: proof of concept. I am not tightly familiar with Thunderbird internals. I hope, it should not break anything in your precious profile data, but I am not completely sure.

Warning. This add-on does not store any data in .msf files (Thunderbird stores the custom column properties though). Lack of such optimization may impair performance, however I have not faced such issue yet. The extension does not add or modify message headers to reflect presence in your notes. Depending on your workflow it may be an advantage or in some cases perhaps a defect.

Introduction

To see how it works you should have some references to messages in your notes. The idea is to use links based on Message-ID header, primary mid: ones, for background see RFC 2392 - Content-ID and Message-ID Uniform Resource Locators. Other link types like news: or mail list archive sites may require some configuration. Examples of such links: mid:sn60sv$105n$1@ciao.gmane.io [[news://news.gmane.io/gmane.emacs.orgmode/sn60sv$105n$1@ciao.gmane.io][LinkRemark browser extension]] <https://list.orgmode.org/sn60sv$105n$1@ciao.gmane.io/>. To access local files Thunderbird extensions should use so called native messaging helper application (backend). The recommended tool to extract links from the notes is bURL https://github.com/maxnikulin/burl. You may create your own one, but I do not consider API as settled, so tracking of changes may be a burden. Configure the helper and specify its ID (name) in the add-on configuration.

Without a configured backend the usage of the extension is quite limited. It may still be helpful to display message headers for Message-ID links in the body of other messages in your mailboxes.

Creating notes linked to messages is not fully supported yet, so this extension does not use org-protocol (info "(org) Protocols"). For a while you may copy mid: links from the mentions page in the popup.

Install

I am going to publish orco add-on to the Thunderbird extension catalog later. For a while download the latest release as an .xpi file from the releases section of the GitHub project https://github.com/maxnikulin/orco/releases/ and use the “install from file” option in the add-on management tab. Alternatively a repository clone may be loaded as a temporary extension from the add-on debugging tab. Thunderbird removes column state from folder views when temporary add-on is not loaded, so it may be inconvenient. A new toolbar button should appear in the mail tabs. Right click on message list header should reveal new column that may be added to the folder view.

Download an archive with bURL from https://github.com/maxnikulin/burl/releases and extract the burl_backend executable, let’s assume that you created ~/.local/share/burl folder for it. Some details related to configuration may be found in README file for bURL and for the LinkRemark browser extension.

If you have installed bURL earlier for LinkRemark, update it to the latest release (bURL-0.4 or later is required). As to configuration, it should be enough to add orco@maxnikulin.github.io the allowed_extensions array in the native application manifest. The latter is located in ~/.mozilla/native-messaging-hosts. If you use news: or nntp: links in your notes then open the wrapper script specified in the path field of the manifest and add e.g. -scheme news option to burl_backend command line.

For new users or if you prefer to have separate configuration for LinkRemark and for orco it is necessary to create a new native messaging application manifest and a wrapper for burl_backend that serves as its configuration file. You need to provide paths to burl_backend and the wrapper, to specify files for link lookup, to choose a name for native messaging helper (“burl” in the example below). Optionally add more URI schemes like -scheme news (mid: and https: links are extracted by default)

mkdir -p ~/.mozilla/native-messaging-hosts
~/.local/share/burl/burl_backend -manifest-firefox ~/.mozilla/native-messaging-hosts/ \
    -mozilla-extension orco@maxnikulin.github.io \
    -backend burl \
    -wrapper ~/.local/share/burl/burl_wrapper \
    -org ~/org/notes.org \
    -org ~/org/capture.org

It should create ~/.mozilla/native-messaging-hosts/burl.json and ~/.local/share/burl/burl_wrapper files. You may edit them to adjust configuration.

Open Thunderbird add-on settings for orco and specify “burl” (or the name you have chosen on the previous step) as native messaging helper. If you have messages linked to the emacs-orgmode mail list archive at https://list.orgmode.org/ than you may add this URL to the list of prefixes.

Click on the add-on toolbar button (browser action) and do “refresh” in the popup. The add-on fetches Message-IDs during Thunderbird startup. There is no option to watch files for changes or setup periodic refresh yet.

To open particular locations in the files where the message is mentioned Emacs server should be running: M-x server-start For background see Server (info "(emacs) Emacs Server").

Link may be hidden inside a folded heading. To open it you may try the following hook:

(defun burl-org-reveal-folded-line ()
  (when (derived-mode-p 'org-mode)
    (org-reveal)))

(add-hook 'server-visit-hook #'burl-org-reveal-folded-line)

Alternatively use C-c C-r that is a binding for M-x org-reveal.

Permissions

For details see Permission request messages for Thunderbird extensions

Have full, unrestricted access to Thunderbird, and your computer

WebExtensions API for add-ons does not provide a way to add custom columns, so low level access using experiment APIs is required to implement the feature. The message sounds dangerous for purpose, so you need to audit the code and to decided if you trust the developers. Actually this extension monitors for tabs and windows with message list, adds column and response to requests what should be displayed for particular messages and threads by querying content of the Message-ID header.

Other permissions are hidden behind the most important one.

Exchange messages with other programs (nativeMessaging)

It is actual way to make requests related to file content or to open particular location in Emacs. Explicit configuration is required to allow native messaging helper, but it is essential as well.

Read your email messages and mark or tag them (messagesRead)

It is used to obtain list of selected or displayed messages in response to browser action click, shortcut, context menu and obtain message headers. Otherwise the extension would have rather limited ability to check mentions in your notes.

Read and modify your email messages as you compose and send them (compose)

Compose message window is a rather specific instance, so messagesRead permission suitable for message display or 3 pane tabs is not enough to get headers of the message while it is composed.

Notice that the extension does not use “Send composed email messages on your behalf” (compose.send) or compose.save. permissions.

menus and storage

These permissions are skipped in the add-on manager. They are necessary to get access for creation of menu entry and to save extension configuration accordingly.

Troubleshooting

The copy button on the log page of the popup puts to clipboard more details than it is shown in the popup.

Check Thunderbird console Ctrl+Shift+J for errors, open add-on debugging tab and click on “Inspect” link to get access to developers tools for the extension and switch to console to see if some problem is reported there.

For native messaging backend problems see the related section in Mozilla developer guide

License

orco is published under the GNU GPLv3 license or any later version, see LICENSE.txt.

icons/orco-128.png