Hi Max,

Max Nikulin <maniku...@gmail.com> writes:

> The author suggests to install from github assets instead of official 
> add-on catalog for some reason. Perhaps it is just survived since times 
> when cb_thunderlink was not published yet.

My new version instructs to install the add-on from Thunderbird, with no
OS installation. It's simpler and safer.

>
> My idea was to push '("\\`mid:" . custom/browse-url-mid) to 
> `browse-url-handlers' having (untested)
>
> (defun custom/browse-url-mid (url &optional _ignored)
>    (browse-url
>     (replace-regexp-in-string "\\`mid:" "thunderlink:/message-id=" url)))
>
> I am unsure concerning double slash after protocol since host name 
> expected after double slash. At least KDE may try to resolve hostname 
> and to distort URI. I hope, Message-ID never contains characters that 
> may require percent encoding when used in query parameter value.
>
> `browse-url-xdg-open' had a lot of revisions before current 
> `call-process' settled inside. It is the reason why I will prefer to 
> avoid explicit calls to `start-process' (alternatives known to me are 
> even worse) and to delegate as much as possible to `browse-url'.

My new version instructs to use standard "mid:" by just running Thunderbird.


> Since you suggest thunderlink: links instead of built-in mid:

I didn't realize that Thunderbird allows to open "mid:". I've simplified
the method.

I'm now using =cb_thunderlink= just to answer the following question, that
currently is on the wiki page:

      you need to copy the value of the Message-ID
      header, it should be possible with some add-on.

i.e. cb_thunderlink allows to build a full org link (link + description).

As it's still not clear to me how to configure browse-url, I'm still relying
on start-process.

See a new version of the patch.

Bruno

>From 89cef9d7acd85828ddfbb1375fac1e805bd03cea Mon Sep 17 00:00:00 2001
From: Bruno BARBIER <brubar...@gmail.com>
Date: Tue, 31 Jan 2023 20:33:22 +0100
Subject: [PATCH] org-faq: links with thunderbird: Add cb_thunderlink

---
 org-faq.org | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/org-faq.org b/org-faq.org
index 0410d368..4c2d0c8f 100644
--- a/org-faq.org
+++ b/org-faq.org
@@ -2051,6 +2051,42 @@ so the following recipe is obsolete:
 Notice that this link uses Message-ID to reference a particular
 message as well.
 
+*** Using the =cb_thunderlink= add-on
+The add-on =cb_thunderlink= for Thunderbird allows to generate direct
+links from emails inside Thunderbird. You can then teach org to repon
+these links.
+
+  1. In Thunderbird, install the =cb_thunderlink= add-on.
+
+  2. In the options page of the =cb_thunderlink= add-on, add a new link
+     type, name it =org= with the following value:
+
+          #+begin_example
+          [[mid:$msgid$][$author_name$: $subject$ ($date_iso$)]]
+          #+end_example
+
+  3. In your emacs init file, add the following lines:
+          #+begin_src elisp
+          (defvar thunderbird-app nil
+            "The absolute path to your thunderbird application.")
+
+          (defun thunderbird-message-with-id (message-id)
+            "Open the given email. MESSAGE-ID is the message id."
+            (start-process "thunderbird" " *thunderbird*"
+                           thunderbird-app
+                           (concat "mid:" message-id)))
+
+          (org-link-set-parameters "mid" :follow 'thunderbird-open-message-with-id)
+          #+end_src
+
+
+In Thunderbird, to copy a link to an email into the clipboard, open
+the contextual menu, click the =cb_thunderlink= entry and choose the
+entry named =org=. Then paste the link in your org file, and, click it
+to re-open the email.
+
+
+
 * Plain Lists
   :PROPERTIES:
   :CUSTOM_ID: Plain-Lists
-- 
2.39.1

Reply via email to