From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0AD2LnHnzGNTNwEAbAwnHQ (envelope-from ) for ; Sun, 22 Jan 2023 08:36:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0BAdL3HnzGMSyAAAauVa8A (envelope-from ) for ; Sun, 22 Jan 2023 08:36:17 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 57E2D7677 for ; Sun, 22 Jan 2023 08:36:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJUsw-0000km-BS; Sun, 22 Jan 2023 02:35:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJUss-0000kO-7O for emacs-orgmode@gnu.org; Sun, 22 Jan 2023 02:35:22 -0500 Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJUsq-0005gf-8s for emacs-orgmode@gnu.org; Sun, 22 Jan 2023 02:35:21 -0500 Received: from localhost ([::ffff:197.239.5.204]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000103952.0000000063CCE71B.000022FB; Sun, 22 Jan 2023 00:34:50 -0700 Date: Sun, 22 Jan 2023 10:29:45 +0300 From: Jean Louis To: AW Cc: emacs-orgmode@gnu.org Subject: Re: Link from orgmode file to E-Mail (using kmail or notmuch) Message-ID: Mail-Followup-To: AW , emacs-orgmode@gnu.org References: <3218434.44csPzL39Z@linux.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3218434.44csPzL39Z@linux.fritz.box> User-Agent: Mutt/2.2.9+54 (af2080d) (2022-11-21) Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_SBL=0.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674372977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ir0XNI7oqa+BEngj4PmRL9jTGtAeWlbbBYBFH7aginA=; b=RDe5DX8vSttTgPO9LwXF9oxEeC1irnYlLneDl8r37CtlRYXc4bo0YgRY7tYRcZE4Q7/vGN E4y8ZTJuVU+iuKo00bdN0P4QOnWTLZ4wTh9r42at52v+NudOYbAhUe04mfHbx0NdHP5xyF 2E/yRTuvyxFNJDq7ekVHL1bzaaasQAE6575bWQ5KCYjNsio4R3iQQttdlzL4FFkgfN0GH4 M5MOZOnW5n6RaKJOtldNYM/D120c+8qcAvJwD6KqTDLlTD5zyv60K3Fk4QE/nMsIW1V+j3 ehhO+3xXXC0MlAfDb0evuOSSz9WQAnFZ/RGasZDmPbrvdgAB5yNd+PMAdc4/5w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674372977; a=rsa-sha256; cv=none; b=njVWPbz3pGpvRVK9tIhErJ6+fBL8CLiIQyMYKwlaDgCADrZyvtuQ3a2Og1lckYPcj3MMD2 zWrup1zmhdN+GSZ0sqk96/ksWVlXDgW6zx0mnBX8W6aYCptFA7jZ/VCIWTTH70fGufYFWz KJUGDV6GLvplOXg9ez74zxJ0X2X2PwPcwbuK5rvNfuDXJTF6mbnkDGDH/R8jtm3merr4RU yWnfhZA6O+8QQC4P4wwc/+ilBpA8P2/8vCK3bnjctLV01nqC7NT8KceiFu+zzin7oEsJJF FeOkgnlHwICeIn/9ykkk4goP3QRsp+G+6hx/5SunYWkavZtsI4bqNZeXrlRNsg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: 1.91 X-Spam-Score: 1.91 X-Migadu-Queue-Id: 57E2D7677 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-TUID: terD7cs1lK3f * AW [2023-01-22 00:33]: > Workflow: E-Mails with a question comes in, I open a TODO heading in > an orgmode file regarding the question. > > Now, I'd like to add a link to the E-Mail under this TODO heading in the > orgmode file. I've seen the manual page about external links, https:// > orgmode.org/manual/External-Links.html I am using Mutt: https://mutt.org which must be in your distribution. There is way how to automatically capture Message-ID and put it outside of the Mutt, though I did not yet implement it. However, if I wish to open specific e-mail I point to the Maildir, or maybe Mbox or other type, Maildir: /home/data1/protected/Maildir/tomas@tuxteam.de Message-ID: Y0mt4/G+DlKlURuC@tuxteam.de Then I use this function: (defun hyperscope-mutt-view-by-message-id (link argument) "Opens email by message ID by using mutt" (let* ((folder link) (message-id (replace-regexp-in-string "=" "\\\\=" argument)) (push (format "push '=i %s'" message-id))) (call-process "xterm" nil nil nil "-e" "mutt" "-f" folder "-e" push))) Where by function must receive LINK and ARGUMENT, whereby ARGUMENT means Message-ID string. xterm is called, mutt launched for FOLDER which is same as LINK, and "-e" specify a command to be executed after initialization, which is in this case "push "'=i Y0mt4/G+DlKlURuC@tuxteam.de'" And I get to see that specific e-mail that was hyperlinked. You may implement this in org by creating elisp: type of links easy. You could call this function different: (defalias 'my-message-id 'hyperscope-mutt-view-by-message-id) (my-message-id LINK ARGUMENT) Opens email by message ID by using mutt [[elisp:(my-message-id "/home/data1/protected/Maildir/tomas@tuxteam.de" "Y0mt4/G+DlKlURuC@tuxteam.de")][Link to my message]] And after clicking on the above Org hyperlink I can see it works well. KMail does not work on my side, so you can see which command line options are available to find message by Message-ID. In Thunderbird you may use this plugin: Copy Message ID :: Add-ons for Thunderbird: https://addons.thunderbird.net/en-us/thunderbird/addon/copy-message-id/ as to get quickly Message-ID. The way to open up in Thunderbird is: ./thunderbird mid:PUT-HERE-YOUR-MESSAGE-ID Here is easier way to insert Message-ID hyperlinks: (defun rcd-org-link-message-id-by-elisp () (interactive) (let* ((my-selection (gui-selection-value)) (functions '("(my-message-id \"%s\" \"%s\")" "(message-id-by-thunderbird \"%s\")")) (function (completing-read "Choose function for Message-ID: " functions nil t)) (name (read-string "Name of link: ")) (folder (read-string "Enter mail folder if any or RET for nothing: ")) (message-id (read-string "Enter Message-ID: " my-selection))) (insert "[[elisp:" (format function folder message-id) "][" name "]]"))) 1. Copy Message ID in memory, but you also need to know Mail folder, depending of function 2. M-x rcd-org-link-message-id-by-elisp and answer questions 3. [[elisp:(my-message-id "my mail folder" "my message ID")][my name]] > I'm on Linux, KDE as GUI, distro Tumbleweed by openSUSE. The E-mail > software is kmail. Unfortunately, there is no way to get the path to > an individual E- mail out of kmail, which I could simply use to put > it into my orgmode file as a link. So I installed notmuchmail and > the emacs package notmuch.el. It requires indexing and wastes time. If you use Mutt, it will open up Message-ID e-mails in breeze. You may invoke external HTML viewers or external program to see e-mails in different way. I know it is double work. Peculiar ways to make Evolution work are explained by Karl Voit: Moving from Thunderbird to Evolution for Emails and Calendar: https://karl-voit.at/2021/06/01/Thunderbird-to-Evolution/ Feature request: getting a message-id link from email + CLI option to open email via message-id (#1508) · Issues · GNOME / evolution · GitLab: https://gitlab.gnome.org/GNOME/evolution/-/issues/1508 > By notmuch-search I can find an individual E-mail. In the E-Mail > buffer I type c I , which copies the message-ID of that E-Mail into > the keyring. Instead of a link I paste the message-ID into my > orgmode file. If I'd like to read the E-Mail again, I can use > notmuch-search: id: to find the E- Mail again. I know, > this is not a really efficient way. Probably you are not surprised > to read my question: How can I have a link in an orgmode file to an > E-Mail using either a feature of kmail oder notmuch ? Regards, We tried to solve this problem for Mutt here, since 3 years already: Feature proposal: provide possibility to link directly to a message (#172) · Issues · Mutt Project / mutt · GitLab: https://gitlab.com/muttmua/mutt/-/issues/172 Of course, one can see that both in Gnome and Mutt society, people hardly understand use cases of capturing hyperlinks to messages. Capturing of e-mails attributes is more of a problem that creating hyperlinks in Org. Good that Mutt supports Muttlisp language. But I do not use it. I did not figure out yet how to make IMAP hyperlinks, but that is definitely possible. Here is how to capture Hyperlinks by using Mutt: ------------------------------------------------ .muttrc settings ---------------- ############## # Folder hooks ############## folder-hook . 'set my_folder=$folder;set folder="XXX";set visual=^' folder-hook . 'setenv MUTTCURRENTFOLDER $visual' folder-hook . 'set folder=$my_folder' macro index,pager \em ":set wait_key=nogrep -i -o -P '(?<=Message-Id: <).*(?=>)' | sed 's%\(.*\)%'\"$MUTTCURRENTFOLDER\"'###\1%' | capture-mutt-message-id.sh $folder" File: capture-mutt-message-id.sh -------------------------------- #!/usr/bin/bash read -r message_id folder="$@" echo "Got folder: $folder with Message-ID: $message_id" emacsclient -e "(rcd-mutt-capture-message-id \"$folder\" \"$message_id\")" sleep 3 Emacs Lisp function: -------------------- This function shall be adapted to be used in Org. There is name, folder and message-id to be used. (defun rcd-mutt-capture-message-id (folder message-id) "Create new Hyperdocument by using FOLDER and MESSAGE-ID." (raise-frame) (x-focus-frame nil) (let* ((name (rcd-ask-get "Name for the Message-ID Hyperdocument: ")) (parent (hyperscope-select-set "Parent set for Message-ID: ")) (id (hyperscope-add-generic name folder nil 22 nil parent message-id))) (rcd-message "Captured Hyperdocument ID: %s Message-ID with folder: %s, and Message-ID: %s" id folder message-id) (hyperscope-isolate id))) Mutt workflow: -------------- 0. It uses Emacs in background, program `emacsclient' should be capable of connecting to Emacs server 1. Open up any e-mail, never mind where it is: 2. press `ESC m' to capture Message ID as hyperlink 3. Emacs will raise it's frame, describe the hyperlink to that Message-ID 4. Continue reading e-mails -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/