[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Link from orgmode file to E-Mail (using kmail or notmuch)
From: |
Jean Louis |
Subject: |
Re: Link from orgmode file to E-Mail (using kmail or notmuch) |
Date: |
Sun, 22 Jan 2023 10:29:45 +0300 |
User-agent: |
Mutt/2.2.9+54 (af2080d) (2022-11-21) |
* AW <alexander.willand@t-online.de> [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 '<search>=i %s<enter><enter>'" 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 "'<search>=i Y0mt4/G+DlKlURuC@tuxteam.de<enter><enter>'"
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: <abc123> 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=no<enter><pipe-entry>grep -i -o -P
'(?<=Message-Id: <).*(?=>)' | sed 's%\(.*\)%'\"$MUTTCURRENTFOLDER\"'###\1%' |
capture-mutt-message-id.sh $folder<enter>"
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/
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), (continued)
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), Jean Louis, 2023/01/24
- [FR] Should Org provide commonly used link types? (was: Link from orgmode file to E-Mail (using kmail or notmuch)), Ihor Radchenko, 2023/01/25
- Should Org provide commonly used link types?, Jean Louis, 2023/01/25
- Re: Should Org provide commonly used link types?, Ihor Radchenko, 2023/01/25
- Re: Should Org provide commonly used link types?, Jean Louis, 2023/01/26
- Re: Should Org provide commonly used link types?, Jean Louis, 2023/01/26
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), Ihor Radchenko, 2023/01/24
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), Max Nikulin, 2023/01/24
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), Jean Louis, 2023/01/24
- Re: Link from orgmode file to E-Mail (using kmail or notmuch), Jean Louis, 2023/01/24
Re: Link from orgmode file to E-Mail (using kmail or notmuch),
Jean Louis <=
Re: Link from orgmode file to E-Mail (using kmail or notmuch), Bruno Barbier, 2023/01/27